package com.wzh.design.combination.bag1;

/**
 * @description: 组合模式
 * @author: WZH
 * @time: 2021/12/24 9:53
 */
public abstract class Component {

    // 集合操作-增
    public void add(Component menuComponent) {
        throw new UnsupportedOperationException();
    }

    // 集合操作-删
    public void remove(Component menuComponent) {
        throw new UnsupportedOperationException();
    }

    // 集合操作-查
    public Component getChild(int i) {
        throw new UnsupportedOperationException();
    }

    public String getName() {
        throw new UnsupportedOperationException();
    }

    public float getPrice() {
        throw new UnsupportedOperationException();
    }

    public void print(int offset) {
        throw new UnsupportedOperationException();
    }

    //偏移量，补空格使用
    public void printOffsed(int offset) {
        StringBuffer blank = new StringBuffer("");
        for (int i = 0; i < offset; i++) {
            blank.append("     ");
        }
        System.out.print(blank);
    }
}





















